package com.kws.system.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.kws.common.core.domain.R;
import com.kws.common.log.annotation.Log;
import com.kws.common.log.enums.BusinessType;
import com.kws.system.domain.SysMessageRemind;
import com.kws.system.domain.info.QueryMessageRemindInfo;
import com.kws.system.domain.vo.*;
import com.kws.system.service.SysMessageRemindService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <b>SysMessageRemindController</b>
 *
 * @description: SysMessageRemindController <br>
 * @date: 2024/11/5 17:44 <br>
 * @author: lhm <br>
 * @version: 1.0 <br>
 */

@Api(tags = "消息提醒模块")
@RestController
public class SysMessageRemindController {
    private static final Logger logger = LoggerFactory.getLogger(SysMessageRemindController.class);

    @Autowired
    private SysMessageRemindService sysMessageRemindService;

    @ApiOperation("分页查询消息提醒列表")
    @GetMapping("/query/messageRemind/page")
    public R<Page<QueryMessageRemindInfo>> queryMessageRemindPage(@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,
                                                                  @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
                                                                  @RequestParam(required = false) String messageName){
        Page<QueryMessageRemindInfo> pageInfo = sysMessageRemindService.queryMessageRemindPage(pageNum,pageSize,messageName);
        return R.ok(pageInfo);
    }

    @ApiOperation("根据消息提醒ID查询消息详情")
    @GetMapping("/query/messageRemind/byId")
    public R<QueryMessageRemindInfo> queryMessageRemindById(@RequestParam Long id){
        QueryMessageRemindInfo info = sysMessageRemindService.queryMessageRemindById(id);
        return R.ok(info);
    }

    @ApiOperation("根据ID删除消息提醒数据")
    @Log(title = "消息提醒", businessType = BusinessType.DELETE)
    @GetMapping("/delete/messageRemind/byId")
    public R deleteMessageRemindById(@RequestParam Long id){
        boolean status = sysMessageRemindService.deleteMessageRemindById(id);
        return R.ok(status);
    }

    @ApiOperation("创建核对商品订单消息通知")
    @PostMapping("/create/checkGoodsOrder/message")
    public R createCheckGoodsOrderMessage(@RequestBody MessageParameterRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建核对服务订单信息通知")
    @PostMapping("/create/checkServeOrder/message")
    public R createCheckServeOrderMessage(@RequestBody CreateCheckServeOrderMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建邀请评价消息通知")
    @PostMapping("/create/inviteEvaluation/message")
    public R createInviteEvaluationMessage(@RequestBody CreateInviteEvaluationMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建邀请下单消息通知")
    @PostMapping("/create/inviteOrder/message")
    public R createInviteOrderMessage(@RequestBody CreateInviteOrderMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
      return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建用户付款消息通知")
    @PostMapping("/create/paymentReminder/message")
    public R createPaymentReminderMessage(@RequestBody CreatePaymentReminderMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建售后服务消息提醒")
    @PostMapping("/create/postSalesService/message")
    public R createPostSalesServiceMessage(@RequestBody CreatePostSalesServiceMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建设备告警消息通知")
    @PostMapping("/create/deviceAlarm/message")
    public R createDeviceAlarmMessage(@RequestBody CreateDeviceAlarmMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建策略下发消息通知")
    @PostMapping("/create/policyDelivery/message")
    public R createPolicyDeliveryMessage(@RequestBody CreatePolicyDeliveryMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建服务上架审核通过消息通知")
    @PostMapping("/create/serviceListingAudit/message")
    public R createServiceListingAuditMessage(@RequestBody CreateServiceListingAuditMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建商品上架审核通过消息通知")
    @PostMapping("/create/productListingReview/message")
    public R createProductListingReviewMessage(@RequestBody CreateProductListingReviewMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建入驻通过消息通知")
    @PostMapping("/create/merchantReview/message")
    public R createMerchantReviewMessage(@RequestBody CreateProductListingReviewMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建合同签订通知消息通知")
    @PostMapping("/create/contractSign/message")
    public R createContractSignMessage(@RequestBody CreateContractSignMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建发票开具结果消息通知")
    @PostMapping("/create/billingResult/message")
    public R createBillingResultMessage(@RequestBody CreateBillingResultMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiModelProperty(value = "创建物流到货消息通知（配送）")
    @PostMapping("/create/logisticsDelivery/message")
    public R createLogisticsDeliveryMessage(@RequestBody CreateLogisticsDeliveryMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建物流到货消息通知（自提）")
    @PostMapping("/create/logisticsPickNotice/message")
    public R createLogisticsPickNoticeMessage(@RequestBody CreateLogisticsPickNoticeMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation(value = "创建工单分发消息通知")
    @PostMapping("/create/workOrder/message")
    public R createWorkOrderMessage(@RequestBody CreateWorkOrderMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation(value = "创建巡检消息通知")
    @PostMapping("/create/inspection/message")
    public R createInspectionMessage(@RequestBody CreateInspectionMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建报修消息通知")
    @PostMapping("/create/repair/message")
    public R createRepairMessage(@RequestBody CreateRepairMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }

    @ApiOperation("创建抢修消息通知")
    @PostMapping("/create/rushRepair/message")
    public R createRushRepairMessage(@RequestBody CreateRushRepairMessageRq rq) throws NoSuchFieldException, IllegalAccessException {
        return sysMessageRemindService.createMessageNotification(rq);
    }
}
